package com.lmc.user.controller;


import com.lmc.user.api.pojo.UserInfoRequest;
import com.lmc.user.api.pojo.UserInfoResponse;
import com.lmc.user.api.pojo.UserLoginResponse;
import com.lmc.user.service.UserService;
import jakarta.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/user")
@RestController
public class UserController implements UserService{

    @Autowired
    private UserService userService;

    @Override
    public UserLoginResponse login(@Validated @RequestBody UserInfoRequest user){
        log.info("用户登录, userName: {}", user.getUserName());
        return userService.login(user);
    }
    @Override
    public UserInfoResponse getUserInfo(@NotNull Integer userId){
        return userService.getUserInfo(userId);
    }

    @Override
    public UserInfoResponse selectAuthorInfoByBlogId(Integer blogId) {
        return null;
    }

    @Override
    public UserInfoResponse getAuthorInfo(@NotNull Integer blogId){
        return userService.selectAuthorInfoByBlogId(blogId);
    }
}
